package base.day18.array;

public class Array3 {
    public static void main(String[] args) {
        int[] array={3,1,5,4,9,};
        int[] newarray=bubbleSort(array);
        for (int i = 0; i < newarray.length; i++) {
            System.out.println(newarray[i]);
        }
    }

    private static int[] bubbleSort(int[] array) {
        for (int i = 0; i < array.length-1; i++) {
            for (int j = 0; j < array.length-1-i; j++) {
                if (array[i]>array[i+1]){
                    int temp=array[i];
                    array[i]=array[i+1];
                    array[i+1]=temp;
                }
            }
        }
        return array;
    }
}
